<?php
    class Widget_Sql extends Tiri_Widget{
        
        private $_sql;
        static private $_db;
        
        public static function __construct($sql = ''){
            $this -> _sql = $sql;
            $this -> _db = Widget_Db::getInstance();    
        }
        public function getTotalNums(){
            $qry = $this -> _db ->query($this -> _sql);
            return $this -> _db -> num_rows($qry);
        }
        public function runSql(){
            $qry = $this -> _db ->query($this -> _sql);
            while($rs = $this -> _db -> fetch_array($qry , MYSQL_ASSOC)){
                
            }
        }
        public function format(){
            
        }
    }
    
?>
